<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>

<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- 上述3个meta标签*必须*放在最前面，任何其他内容都*必须*跟随其后！ -->
<link rel="icon" href="<c:url value='/images/favicon.ico'/>">

<title>left</title>
<!-- 新 Bootstrap 核心 CSS 文件 -->
<link rel="stylesheet"
	href="//cdn.bootcss.com/bootstrap/3.3.5/css/bootstrap.min.css">

<!-- 可选的Bootstrap主题文件（一般不用引入） -->
<link rel="stylesheet"
	href="//cdn.bootcss.com/bootstrap/3.3.5/css/bootstrap-theme.min.css">

<link rel="stylesheet" href="<c:url value='/css/user/login.css'/>">
<!-- jQuery文件。务必在bootstrap.min.js 之前引入 -->
<script src="//cdn.bootcss.com/jquery/1.11.3/jquery.min.js"></script>

<!-- 最新的 Bootstrap 核心 JavaScript 文件 -->
<script src="//cdn.bootcss.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>
<!-- 	<script type="text/javascript">
		$(function(){
			$.ajax({
				url:"/goods/CategoryServlet",
				data:{method:"findAll"},
				type:"post",
				datatype:"json",
				async:false,
				cache:false,
				success:function(result){
				}
			});
		});
	</script> -->
</head>
<body>
	<div class="col-md-2">
		<div class="panel panel-default">
			<div class="panel-heading">
				<span class="glyphicon glyphicon-book" aria-hidden="true"></span>
				Asura书城
			</div>
			<div class="panel-body" style="padding: 0;">
				<%-- <form action="<c:url value='/CategoryServlet?method=findAll'/>"
					method="POST"> --%>
				<ul class="nav nav-tabs nav-stacked">

					<c:forEach items="${parents }" var="parent">
						<li class="navIndex" id="abc"><a href="#"><span
								class="glyphicon glyphicon-plus-sign" aria-hidden="true"></span>
								${parent.cname }</a>
							<ul class="nav nav-tabs nav-stacked">
								<c:forEach items="${parent.children }" var="child">
									<li><a href="<c:url value='/BookServlet?method=findByCategory&cid=${child.cid }'/>" target="body">${child.cname }</a></li>
								</c:forEach>
							</ul></li>
					</c:forEach>
				</ul>
			</div>
		</div>
	</div>
	<script type="text/javascript">
		var flip = 0;
		$(".navIndex").find("ul").hide();
		$(".navIndex").find("li").click(function(e){
			e.stopPropagation();
		});
		$(".navIndex").click(function(e) {
			if (flip++ % 2 === 0) {
				$(this).children().show().find("span").removeClass("glyphicon glyphicon-plus-sign").addClass("glyphicon glyphicon-minus-sign");
			} else {
				$(this).find("ul").hide();
				$(this).find("span").removeClass("glyphicon glyphicon-minus-sign").addClass("glyphicon glyphicon-plus-sign");
			}
		});
	</script>
</body>
</html>